3.1.53 \(\int \frac {(A+B \cos (c+d x)) \sec ^2(c+d x)}{(a+a \cos (c+d x))^2} \, dx\) [53]

3.1.53.1 Optimal result
3.1.53.2 Mathematica [B] (verified)
3.1.53.3 Rubi [A] (verified)
3.1.53.4 Maple [A] (verified)
3.1.53.5 Fricas [B] (verification not implemented)
3.1.53.6 Sympy [F]
3.1.53.7 Maxima [B] (verification not implemented)
3.1.53.8 Giac [A] (verification not implemented)
3.1.53.9 Mupad [B] (verification not implemented)

3.1.53.1 Optimal result

Integrand size = 31, antiderivative size = 107 \[ \int \frac {(A+B \cos (c+d x)) \sec ^2(c+d x)}{(a+a \cos (c+d x))^2} \, dx=-\frac {(2 A-B) \text {arctanh}(\sin (c+d x))}{a^2 d}+\frac {2 (5 A-2 B) \tan (c+d x)}{3 a^2 d}-\frac {(2 A-B) \tan (c+d x)}{a^2 d (1+\cos (c+d x))}-\frac {(A-B) \tan (c+d x)}{3 d (a+a \cos (c+d x))^2} \]

output
-(2*A-B)*arctanh(sin(d*x+c))/a^2/d+2/3*(5*A-2*B)*tan(d*x+c)/a^2/d-(2*A-B)* 
tan(d*x+c)/a^2/d/(1+cos(d*x+c))-1/3*(A-B)*tan(d*x+c)/d/(a+a*cos(d*x+c))^2
 
3.1.53.2 Mathematica [B] (verified)

Leaf count is larger than twice the leaf count of optimal. \(264\) vs. \(2(107)=214\).

Time = 1.79 (sec) , antiderivative size = 264, normalized size of antiderivative = 2.47 \[ \int \frac {(A+B \cos (c+d x)) \sec ^2(c+d x)}{(a+a \cos (c+d x))^2} \, dx=\frac {2 \cos \left (\frac {1}{2} (c+d x)\right ) \left ((A-B) \sec \left (\frac {c}{2}\right ) \sin \left (\frac {d x}{2}\right )+2 (7 A-4 B) \cos ^2\left (\frac {1}{2} (c+d x)\right ) \sec \left (\frac {c}{2}\right ) \sin \left (\frac {d x}{2}\right )+6 \cos ^3\left (\frac {1}{2} (c+d x)\right ) \left ((2 A-B) \left (\log \left (\cos \left (\frac {1}{2} (c+d x)\right )-\sin \left (\frac {1}{2} (c+d x)\right )\right )-\log \left (\cos \left (\frac {1}{2} (c+d x)\right )+\sin \left (\frac {1}{2} (c+d x)\right )\right )\right )+\frac {A \sin (d x)}{\left (\cos \left (\frac {c}{2}\right )-\sin \left (\frac {c}{2}\right )\right ) \left (\cos \left (\frac {c}{2}\right )+\sin \left (\frac {c}{2}\right )\right ) \left (\cos \left (\frac {1}{2} (c+d x)\right )-\sin \left (\frac {1}{2} (c+d x)\right )\right ) \left (\cos \left (\frac {1}{2} (c+d x)\right )+\sin \left (\frac {1}{2} (c+d x)\right )\right )}\right )+(A-B) \cos \left (\frac {1}{2} (c+d x)\right ) \tan \left (\frac {c}{2}\right )\right )}{3 a^2 d (1+\cos (c+d x))^2} \]

input
Integrate[((A + B*Cos[c + d*x])*Sec[c + d*x]^2)/(a + a*Cos[c + d*x])^2,x]
 
output
(2*Cos[(c + d*x)/2]*((A - B)*Sec[c/2]*Sin[(d*x)/2] + 2*(7*A - 4*B)*Cos[(c 
+ d*x)/2]^2*Sec[c/2]*Sin[(d*x)/2] + 6*Cos[(c + d*x)/2]^3*((2*A - B)*(Log[C 
os[(c + d*x)/2] - Sin[(c + d*x)/2]] - Log[Cos[(c + d*x)/2] + Sin[(c + d*x) 
/2]]) + (A*Sin[d*x])/((Cos[c/2] - Sin[c/2])*(Cos[c/2] + Sin[c/2])*(Cos[(c 
+ d*x)/2] - Sin[(c + d*x)/2])*(Cos[(c + d*x)/2] + Sin[(c + d*x)/2]))) + (A 
 - B)*Cos[(c + d*x)/2]*Tan[c/2]))/(3*a^2*d*(1 + Cos[c + d*x])^2)
 
3.1.53.3 Rubi [A] (verified)

Time = 0.79 (sec) , antiderivative size = 115, normalized size of antiderivative = 1.07, number of steps used = 11, number of rules used = 10, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.323, Rules used = {3042, 3457, 3042, 3457, 3042, 3227, 3042, 4254, 24, 4257}

Below are the steps used by Rubi to obtain the solution. The rule number used for the transformation is given above next to the arrow. The rules definitions used are listed below.

\(\displaystyle \int \frac {\sec ^2(c+d x) (A+B \cos (c+d x))}{(a \cos (c+d x)+a)^2} \, dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int \frac {A+B \sin \left (c+d x+\frac {\pi }{2}\right )}{\sin \left (c+d x+\frac {\pi }{2}\right )^2 \left (a \sin \left (c+d x+\frac {\pi }{2}\right )+a\right )^2}dx\)

\(\Big \downarrow \) 3457

\(\displaystyle \frac {\int \frac {(a (4 A-B)-2 a (A-B) \cos (c+d x)) \sec ^2(c+d x)}{\cos (c+d x) a+a}dx}{3 a^2}-\frac {(A-B) \tan (c+d x)}{3 d (a \cos (c+d x)+a)^2}\)

\(\Big \downarrow \) 3042

\(\displaystyle \frac {\int \frac {a (4 A-B)-2 a (A-B) \sin \left (c+d x+\frac {\pi }{2}\right )}{\sin \left (c+d x+\frac {\pi }{2}\right )^2 \left (\sin \left (c+d x+\frac {\pi }{2}\right ) a+a\right )}dx}{3 a^2}-\frac {(A-B) \tan (c+d x)}{3 d (a \cos (c+d x)+a)^2}\)

\(\Big \downarrow \) 3457

\(\displaystyle \frac {\frac {\int \left (2 a^2 (5 A-2 B)-3 a^2 (2 A-B) \cos (c+d x)\right ) \sec ^2(c+d x)dx}{a^2}-\frac {3 (2 A-B) \tan (c+d x)}{d (\cos (c+d x)+1)}}{3 a^2}-\frac {(A-B) \tan (c+d x)}{3 d (a \cos (c+d x)+a)^2}\)

\(\Big \downarrow \) 3042

\(\displaystyle \frac {\frac {\int \frac {2 a^2 (5 A-2 B)-3 a^2 (2 A-B) \sin \left (c+d x+\frac {\pi }{2}\right )}{\sin \left (c+d x+\frac {\pi }{2}\right )^2}dx}{a^2}-\frac {3 (2 A-B) \tan (c+d x)}{d (\cos (c+d x)+1)}}{3 a^2}-\frac {(A-B) \tan (c+d x)}{3 d (a \cos (c+d x)+a)^2}\)

\(\Big \downarrow \) 3227

\(\displaystyle \frac {\frac {2 a^2 (5 A-2 B) \int \sec ^2(c+d x)dx-3 a^2 (2 A-B) \int \sec (c+d x)dx}{a^2}-\frac {3 (2 A-B) \tan (c+d x)}{d (\cos (c+d x)+1)}}{3 a^2}-\frac {(A-B) \tan (c+d x)}{3 d (a \cos (c+d x)+a)^2}\)

\(\Big \downarrow \) 3042

\(\displaystyle \frac {\frac {2 a^2 (5 A-2 B) \int \csc \left (c+d x+\frac {\pi }{2}\right )^2dx-3 a^2 (2 A-B) \int \csc \left (c+d x+\frac {\pi }{2}\right )dx}{a^2}-\frac {3 (2 A-B) \tan (c+d x)}{d (\cos (c+d x)+1)}}{3 a^2}-\frac {(A-B) \tan (c+d x)}{3 d (a \cos (c+d x)+a)^2}\)

\(\Big \downarrow \) 4254

\(\displaystyle \frac {\frac {-\frac {2 a^2 (5 A-2 B) \int 1d(-\tan (c+d x))}{d}-3 a^2 (2 A-B) \int \csc \left (c+d x+\frac {\pi }{2}\right )dx}{a^2}-\frac {3 (2 A-B) \tan (c+d x)}{d (\cos (c+d x)+1)}}{3 a^2}-\frac {(A-B) \tan (c+d x)}{3 d (a \cos (c+d x)+a)^2}\)

\(\Big \downarrow \) 24

\(\displaystyle \frac {\frac {\frac {2 a^2 (5 A-2 B) \tan (c+d x)}{d}-3 a^2 (2 A-B) \int \csc \left (c+d x+\frac {\pi }{2}\right )dx}{a^2}-\frac {3 (2 A-B) \tan (c+d x)}{d (\cos (c+d x)+1)}}{3 a^2}-\frac {(A-B) \tan (c+d x)}{3 d (a \cos (c+d x)+a)^2}\)

\(\Big \downarrow \) 4257

\(\displaystyle \frac {\frac {\frac {2 a^2 (5 A-2 B) \tan (c+d x)}{d}-\frac {3 a^2 (2 A-B) \text {arctanh}(\sin (c+d x))}{d}}{a^2}-\frac {3 (2 A-B) \tan (c+d x)}{d (\cos (c+d x)+1)}}{3 a^2}-\frac {(A-B) \tan (c+d x)}{3 d (a \cos (c+d x)+a)^2}\)

input
Int[((A + B*Cos[c + d*x])*Sec[c + d*x]^2)/(a + a*Cos[c + d*x])^2,x]
 
output
-1/3*((A - B)*Tan[c + d*x])/(d*(a + a*Cos[c + d*x])^2) + ((-3*(2*A - B)*Ta 
n[c + d*x])/(d*(1 + Cos[c + d*x])) + ((-3*a^2*(2*A - B)*ArcTanh[Sin[c + d* 
x]])/d + (2*a^2*(5*A - 2*B)*Tan[c + d*x])/d)/a^2)/(3*a^2)
 

3.1.53.3.1 Defintions of rubi rules used

rule 24
Int[a_, x_Symbol] :> Simp[a*x, x] /; FreeQ[a, x]
 

rule 3042
Int[u_, x_Symbol] :> Int[DeactivateTrig[u, x], x] /; FunctionOfTrigOfLinear 
Q[u, x]
 

rule 3227
Int[((b_.)*sin[(e_.) + (f_.)*(x_)])^(m_)*((c_) + (d_.)*sin[(e_.) + (f_.)*(x 
_)]), x_Symbol] :> Simp[c   Int[(b*Sin[e + f*x])^m, x], x] + Simp[d/b   Int 
[(b*Sin[e + f*x])^(m + 1), x], x] /; FreeQ[{b, c, d, e, f, m}, x]
 

rule 3457
Int[((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_)*((A_.) + (B_.)*sin[(e_.) + 
(f_.)*(x_)])*((c_.) + (d_.)*sin[(e_.) + (f_.)*(x_)])^(n_), x_Symbol] :> Sim 
p[b*(A*b - a*B)*Cos[e + f*x]*(a + b*Sin[e + f*x])^m*((c + d*Sin[e + f*x])^( 
n + 1)/(a*f*(2*m + 1)*(b*c - a*d))), x] + Simp[1/(a*(2*m + 1)*(b*c - a*d)) 
  Int[(a + b*Sin[e + f*x])^(m + 1)*(c + d*Sin[e + f*x])^n*Simp[B*(a*c*m + b 
*d*(n + 1)) + A*(b*c*(m + 1) - a*d*(2*m + n + 2)) + d*(A*b - a*B)*(m + n + 
2)*Sin[e + f*x], x], x], x] /; FreeQ[{a, b, c, d, e, f, A, B, n}, x] && NeQ 
[b*c - a*d, 0] && EqQ[a^2 - b^2, 0] && NeQ[c^2 - d^2, 0] && LtQ[m, -2^(-1)] 
 &&  !GtQ[n, 0] && IntegerQ[2*m] && (IntegerQ[2*n] || EqQ[c, 0])
 

rule 4254
Int[csc[(c_.) + (d_.)*(x_)]^(n_), x_Symbol] :> Simp[-d^(-1)   Subst[Int[Exp 
andIntegrand[(1 + x^2)^(n/2 - 1), x], x], x, Cot[c + d*x]], x] /; FreeQ[{c, 
 d}, x] && IGtQ[n/2, 0]
 

rule 4257
Int[csc[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-ArcTanh[Cos[c + d*x]]/d, x] 
 /; FreeQ[{c, d}, x]
 
3.1.53.4 Maple [A] (verified)

Time = 1.44 (sec) , antiderivative size = 126, normalized size of antiderivative = 1.18

method result size
parallelrisch \(\frac {12 \cos \left (d x +c \right ) \left (A -\frac {B}{2}\right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )-12 \cos \left (d x +c \right ) \left (A -\frac {B}{2}\right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )+14 \left (\left (\frac {5 A}{14}-\frac {B}{7}\right ) \cos \left (2 d x +2 c \right )+\left (A -\frac {5 B}{14}\right ) \cos \left (d x +c \right )+\frac {4 A}{7}-\frac {B}{7}\right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right ) \left (\sec ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{6 d \,a^{2} \cos \left (d x +c \right )}\) \(126\)
derivativedivides \(\frac {\frac {\left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right ) A}{3}-\frac {\left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right ) B}{3}+5 A \tan \left (\frac {d x}{2}+\frac {c}{2}\right )-3 B \tan \left (\frac {d x}{2}+\frac {c}{2}\right )+\left (2 B -4 A \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )-\frac {2 A}{\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1}+\left (4 A -2 B \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )-\frac {2 A}{\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1}}{2 d \,a^{2}}\) \(134\)
default \(\frac {\frac {\left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right ) A}{3}-\frac {\left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right ) B}{3}+5 A \tan \left (\frac {d x}{2}+\frac {c}{2}\right )-3 B \tan \left (\frac {d x}{2}+\frac {c}{2}\right )+\left (2 B -4 A \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )-\frac {2 A}{\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1}+\left (4 A -2 B \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )-\frac {2 A}{\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1}}{2 d \,a^{2}}\) \(134\)
norman \(\frac {\frac {\left (A -B \right ) \left (\tan ^{7}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{6 a d}-\frac {3 \left (3 A -B \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{2 a d}+\frac {\left (5 A -3 B \right ) \left (\tan ^{5}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{2 a d}-\frac {\left (13 A -B \right ) \left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{6 a d}}{\left (1+\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right ) \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )-1\right ) a}+\frac {\left (2 A -B \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}{a^{2} d}-\frac {\left (2 A -B \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}{a^{2} d}\) \(190\)
risch \(\frac {2 i \left (6 A \,{\mathrm e}^{4 i \left (d x +c \right )}-3 B \,{\mathrm e}^{4 i \left (d x +c \right )}+18 A \,{\mathrm e}^{3 i \left (d x +c \right )}-9 B \,{\mathrm e}^{3 i \left (d x +c \right )}+22 A \,{\mathrm e}^{2 i \left (d x +c \right )}-7 B \,{\mathrm e}^{2 i \left (d x +c \right )}+24 A \,{\mathrm e}^{i \left (d x +c \right )}-9 B \,{\mathrm e}^{i \left (d x +c \right )}+10 A -4 B \right )}{3 d \,a^{2} \left ({\mathrm e}^{i \left (d x +c \right )}+1\right )^{3} \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )}-\frac {2 A \ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right )}{a^{2} d}+\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) B}{a^{2} d}+\frac {2 A \ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right )}{a^{2} d}-\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) B}{a^{2} d}\) \(227\)

input
int((A+B*cos(d*x+c))*sec(d*x+c)^2/(a+cos(d*x+c)*a)^2,x,method=_RETURNVERBO 
SE)
 
output
1/6*(12*cos(d*x+c)*(A-1/2*B)*ln(tan(1/2*d*x+1/2*c)-1)-12*cos(d*x+c)*(A-1/2 
*B)*ln(tan(1/2*d*x+1/2*c)+1)+14*((5/14*A-1/7*B)*cos(2*d*x+2*c)+(A-5/14*B)* 
cos(d*x+c)+4/7*A-1/7*B)*tan(1/2*d*x+1/2*c)*sec(1/2*d*x+1/2*c)^2)/d/a^2/cos 
(d*x+c)
 
3.1.53.5 Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 207 vs. \(2 (103) = 206\).

Time = 0.29 (sec) , antiderivative size = 207, normalized size of antiderivative = 1.93 \[ \int \frac {(A+B \cos (c+d x)) \sec ^2(c+d x)}{(a+a \cos (c+d x))^2} \, dx=-\frac {3 \, {\left ({\left (2 \, A - B\right )} \cos \left (d x + c\right )^{3} + 2 \, {\left (2 \, A - B\right )} \cos \left (d x + c\right )^{2} + {\left (2 \, A - B\right )} \cos \left (d x + c\right )\right )} \log \left (\sin \left (d x + c\right ) + 1\right ) - 3 \, {\left ({\left (2 \, A - B\right )} \cos \left (d x + c\right )^{3} + 2 \, {\left (2 \, A - B\right )} \cos \left (d x + c\right )^{2} + {\left (2 \, A - B\right )} \cos \left (d x + c\right )\right )} \log \left (-\sin \left (d x + c\right ) + 1\right ) - 2 \, {\left (2 \, {\left (5 \, A - 2 \, B\right )} \cos \left (d x + c\right )^{2} + {\left (14 \, A - 5 \, B\right )} \cos \left (d x + c\right ) + 3 \, A\right )} \sin \left (d x + c\right )}{6 \, {\left (a^{2} d \cos \left (d x + c\right )^{3} + 2 \, a^{2} d \cos \left (d x + c\right )^{2} + a^{2} d \cos \left (d x + c\right )\right )}} \]

input
integrate((A+B*cos(d*x+c))*sec(d*x+c)^2/(a+a*cos(d*x+c))^2,x, algorithm="f 
ricas")
 
output
-1/6*(3*((2*A - B)*cos(d*x + c)^3 + 2*(2*A - B)*cos(d*x + c)^2 + (2*A - B) 
*cos(d*x + c))*log(sin(d*x + c) + 1) - 3*((2*A - B)*cos(d*x + c)^3 + 2*(2* 
A - B)*cos(d*x + c)^2 + (2*A - B)*cos(d*x + c))*log(-sin(d*x + c) + 1) - 2 
*(2*(5*A - 2*B)*cos(d*x + c)^2 + (14*A - 5*B)*cos(d*x + c) + 3*A)*sin(d*x 
+ c))/(a^2*d*cos(d*x + c)^3 + 2*a^2*d*cos(d*x + c)^2 + a^2*d*cos(d*x + c))
 
3.1.53.6 Sympy [F]

\[ \int \frac {(A+B \cos (c+d x)) \sec ^2(c+d x)}{(a+a \cos (c+d x))^2} \, dx=\frac {\int \frac {A \sec ^{2}{\left (c + d x \right )}}{\cos ^{2}{\left (c + d x \right )} + 2 \cos {\left (c + d x \right )} + 1}\, dx + \int \frac {B \cos {\left (c + d x \right )} \sec ^{2}{\left (c + d x \right )}}{\cos ^{2}{\left (c + d x \right )} + 2 \cos {\left (c + d x \right )} + 1}\, dx}{a^{2}} \]

input
integrate((A+B*cos(d*x+c))*sec(d*x+c)**2/(a+a*cos(d*x+c))**2,x)
 
output
(Integral(A*sec(c + d*x)**2/(cos(c + d*x)**2 + 2*cos(c + d*x) + 1), x) + I 
ntegral(B*cos(c + d*x)*sec(c + d*x)**2/(cos(c + d*x)**2 + 2*cos(c + d*x) + 
 1), x))/a**2
 
3.1.53.7 Maxima [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 244 vs. \(2 (103) = 206\).

Time = 0.26 (sec) , antiderivative size = 244, normalized size of antiderivative = 2.28 \[ \int \frac {(A+B \cos (c+d x)) \sec ^2(c+d x)}{(a+a \cos (c+d x))^2} \, dx=\frac {A {\left (\frac {\frac {15 \, \sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} + \frac {\sin \left (d x + c\right )^{3}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{3}}}{a^{2}} - \frac {12 \, \log \left (\frac {\sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} + 1\right )}{a^{2}} + \frac {12 \, \log \left (\frac {\sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} - 1\right )}{a^{2}} + \frac {12 \, \sin \left (d x + c\right )}{{\left (a^{2} - \frac {a^{2} \sin \left (d x + c\right )^{2}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{2}}\right )} {\left (\cos \left (d x + c\right ) + 1\right )}}\right )} - B {\left (\frac {\frac {9 \, \sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} + \frac {\sin \left (d x + c\right )^{3}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{3}}}{a^{2}} - \frac {6 \, \log \left (\frac {\sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} + 1\right )}{a^{2}} + \frac {6 \, \log \left (\frac {\sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} - 1\right )}{a^{2}}\right )}}{6 \, d} \]

input
integrate((A+B*cos(d*x+c))*sec(d*x+c)^2/(a+a*cos(d*x+c))^2,x, algorithm="m 
axima")
 
output
1/6*(A*((15*sin(d*x + c)/(cos(d*x + c) + 1) + sin(d*x + c)^3/(cos(d*x + c) 
 + 1)^3)/a^2 - 12*log(sin(d*x + c)/(cos(d*x + c) + 1) + 1)/a^2 + 12*log(si 
n(d*x + c)/(cos(d*x + c) + 1) - 1)/a^2 + 12*sin(d*x + c)/((a^2 - a^2*sin(d 
*x + c)^2/(cos(d*x + c) + 1)^2)*(cos(d*x + c) + 1))) - B*((9*sin(d*x + c)/ 
(cos(d*x + c) + 1) + sin(d*x + c)^3/(cos(d*x + c) + 1)^3)/a^2 - 6*log(sin( 
d*x + c)/(cos(d*x + c) + 1) + 1)/a^2 + 6*log(sin(d*x + c)/(cos(d*x + c) + 
1) - 1)/a^2))/d
 
3.1.53.8 Giac [A] (verification not implemented)

Time = 0.34 (sec) , antiderivative size = 155, normalized size of antiderivative = 1.45 \[ \int \frac {(A+B \cos (c+d x)) \sec ^2(c+d x)}{(a+a \cos (c+d x))^2} \, dx=-\frac {\frac {6 \, {\left (2 \, A - B\right )} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 1 \right |}\right )}{a^{2}} - \frac {6 \, {\left (2 \, A - B\right )} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 1 \right |}\right )}{a^{2}} + \frac {12 \, A \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}{{\left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 1\right )} a^{2}} - \frac {A a^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - B a^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + 15 \, A a^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 9 \, B a^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}{a^{6}}}{6 \, d} \]

input
integrate((A+B*cos(d*x+c))*sec(d*x+c)^2/(a+a*cos(d*x+c))^2,x, algorithm="g 
iac")
 
output
-1/6*(6*(2*A - B)*log(abs(tan(1/2*d*x + 1/2*c) + 1))/a^2 - 6*(2*A - B)*log 
(abs(tan(1/2*d*x + 1/2*c) - 1))/a^2 + 12*A*tan(1/2*d*x + 1/2*c)/((tan(1/2* 
d*x + 1/2*c)^2 - 1)*a^2) - (A*a^4*tan(1/2*d*x + 1/2*c)^3 - B*a^4*tan(1/2*d 
*x + 1/2*c)^3 + 15*A*a^4*tan(1/2*d*x + 1/2*c) - 9*B*a^4*tan(1/2*d*x + 1/2* 
c))/a^6)/d
 
3.1.53.9 Mupad [B] (verification not implemented)

Time = 0.30 (sec) , antiderivative size = 123, normalized size of antiderivative = 1.15 \[ \int \frac {(A+B \cos (c+d x)) \sec ^2(c+d x)}{(a+a \cos (c+d x))^2} \, dx=\frac {\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\left (\frac {A-B}{a^2}+\frac {3\,A-B}{2\,a^2}\right )}{d}+\frac {{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^3\,\left (A-B\right )}{6\,a^2\,d}-\frac {2\,A\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}{d\,\left (a^2\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2-a^2\right )}-\frac {2\,\mathrm {atanh}\left (\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\right )\,\left (2\,A-B\right )}{a^2\,d} \]

input
int((A + B*cos(c + d*x))/(cos(c + d*x)^2*(a + a*cos(c + d*x))^2),x)
 
output
(tan(c/2 + (d*x)/2)*((A - B)/a^2 + (3*A - B)/(2*a^2)))/d + (tan(c/2 + (d*x 
)/2)^3*(A - B))/(6*a^2*d) - (2*A*tan(c/2 + (d*x)/2))/(d*(a^2*tan(c/2 + (d* 
x)/2)^2 - a^2)) - (2*atanh(tan(c/2 + (d*x)/2))*(2*A - B))/(a^2*d)